package o2o.config;

import o2o.config.annotation.CustomLoginUserHandlerMethodArgumentResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @User: @Created by yangtk
 * @Date: @Date 2020/11/11 19:08
 * @Email: yangtongkuan@qq.com
 * @To change this template use File | Settings | File Templates.
 * @desc
 */
@Configuration
public class CustomWebMvcConfig extends WebMvcConfigurerAdapter {

    @Bean
    public HandlerMethodArgumentResolver customLoginUserHandlerMethodArgumentResolver() {
        return new CustomLoginUserHandlerMethodArgumentResolver();
    }

    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
        argumentResolvers.add(customLoginUserHandlerMethodArgumentResolver());
        super.addArgumentResolvers(argumentResolvers);
    }
}
